package com.tsf.demo.commons.token;

import com.tencent.tsf.gateway.core.constant.AlgType;
import com.tencent.tsf.gateway.core.util.SignUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * <p><em>Created on 2022/2/21 5:04 下午</em></p>
 * 网关秘钥鉴权的工具类
 * @author fuzhongtang
 * @since 1.0.1
 */
public class SecretSignUtil {
    private static final Logger logger = LoggerFactory.getLogger(SecretSignUtil.class);

    public static void main(String[] args) {
        String secretId = "ZBoYVkyNR4abT1dDIFwhFw=="; //在控制台的网关配置秘钥，自动生成secretId
        String secretKey = "HZhM9VaPsIiZ+1mizc3ZIg=="; //在控制台的网关配置秘钥，自动生成secretKey
        String nonce = "D7pAR5fqXXXXx1yacuVzdO";
        AlgType algType = AlgType.HMAC_SHA_1;
        System.out.println("x-mg-sign签名密文 "+SignUtil.generate(nonce, secretId, secretKey, algType));
    }
}
